package SHIYAN;

class Complex{
    double rea;
    double vir;
    public Complex(double rea,double vir)
    {
        this.rea = rea;
        this.vir = vir;
    }

    public double getRea() {
        return rea;
    }

    public double getVir()
    {
        return vir;
    }

   public void prints()
   {
       System.out.println(rea+"+"+vir+"i");
   }

    public Complex add(Complex c1, Complex c2)
    {
         Complex c = new Complex(c1.getRea()+c2.getRea(),c1.getVir()+c2.getVir());
        return c;
    }

    public Complex rec(Complex c1, Complex c2)
    {
        Complex c = new Complex(c1.getRea()-c2.getRea(),c1.getVir()-c2.getVir());
        return c;
    }
}

public class SHIYAN3 {
    public static void main(String[] args){
        Complex c1 = new Complex(2,6);
        Complex c2 = new Complex(3,4);
        Complex c = new Complex(0,0);
        c = c.add(c1,c2);
        c.prints();
        c = c.rec(c1,c2);
        c.prints();
    }
}
